﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using DataLib.Accounts.Bus;

namespace Ewts.Storage
{
    /// <summary>
    /// </summary>
    public partial class TallyByLoadnum : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Session["UserInfo"] == null)
                {
                    Response.Redirect("/Accounts/Login.aspx");
                }
                else
                {
                    if (Request.Cookies["tally"] != null)
                    {
                        HttpCookie myCookie = new HttpCookie("tally");
                        myCookie.Expires = DateTime.Now.AddDays(-1d);
                        Response.Cookies.Add(myCookie);
                    }
                  //  bindData();

                }
            }
        }

        //绑定数据
        public void bindData()
        {
            DataLib.BLL.Tally bll = new DataLib.BLL.Tally();
            DataTable dt = new DataTable();
         
            if (Request["cumid"] != null && Request["cumid"].ToString().Trim() != "")
            {
              //  dt = bll.GetTallyList(null, Request["cumid"].ToString().Trim());
             }
            else
            {
                if (Session["UserInfo"] != null)
                {
                    User curUser = new DataLib.Accounts.Bus.User();
                    curUser = (User)Session["UserInfo"];
                    //string city = "";
                    //if (curUser.UserType == "AD")
                    //    city = "";
                    //else
                    //    city = curUser.CompanyCity;
                    //dt = bll.GetTallyList(city, null);
                }
             }
             //reptCustomer.DataSource = dt;
             //reptCustomer.DataBind();

        }



        /// <summary>
        /// 获取url链接
        /// </summary>
        /// <param name="loadid"></param>
        /// <param name="outid"></param>
        /// <returns></returns>
        protected string getUrl(string loadid,string outid,string urltype,string utype)
        {
            string strtemp = "";
            if(urltype == "1")  //
                strtemp = "<a href='TallyList.aspx?{0}={1}' >理货列表</a>";
            else
                strtemp = "<a href='Tally.aspx?{0}={1}' >新增理货</a>";
            string [] arr = new string[2];
            if(utype == "1")
            {
                arr[0]="loadid";
                arr[1]=loadid;
            }
            else
            {
                arr[0] = "outid";
                arr[1] = outid;
            }
            string strurl = string.Format(strtemp, arr);
            return strurl;
        }
    }
}
